package com.itcast.cn.myhashset;

import com.sun.javafx.collections.MappingChange;

import java.util.*;

/**
 * @PackageName: com.itcast.cn.myhashset
 * @ClassName: Map03
 * @Author: wusong
 * @Date: 2020/7/7 0007 10:41
 * @Description:
 */
public class Map03 {
    public static void main(String[] args) {
        HashMap<Student, String> hm = new HashMap();
        Student s1 = new Student("xiaoming", 22);
        Student s2 = new Student("xiaozhang", 25);
        Student s3 = new Student("daming", 26);
        hm.put(s1, "上海");
        hm.put(s2, "西安");
        hm.put(s3, "河南");
        final Set<Student> keySet = hm.keySet();
        hm.forEach(
                (Student key,String value)->{
                    System.out.println(key+ " " + value);
                }
        );
      /*  Iterator<Student> it = keySet.iterator();
        while (it.hasNext()) {
            Student next = it.next();
            final String T = hm.get(next);
            System.out.println(keySet + " " + T);*/
        /*Set<Map.Entry<Student, String>> entries = hm.entrySet();
        for (Map.Entry<Student, String> entry : entries) {
            final Student key = entry.getKey();
            final String value = entry.getValue();
            System.out.println(key + "---" + value);
        }*/
        }
}

